package cn.com.bod.fas.dm.service.impl;


import cn.com.bod.fas.dm.api.service.LoanApplicationService;
import cn.com.bod.fas.dm.constant.enumconst.CommonRequUrl;
import cn.com.yusys.yusp.commons.web.rest.dto.ResultDto;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @description 贷款申请资金方调用类
 * @author zbb
 * @date 2019年9月23日 15:23
 * @version 1.0.0
 * @Copyright (c) scfhdt
 */
@Service
public class LoanApplicationServiceImpl implements LoanApplicationService {

    /**
     * @description 贷款申请资金方调用
     * @author zbb
     * @date 2019年9月23日 15:23
     * @param code
     * @return  cn.com.yusys.yusp.commons.web.rest.dto.ResultDto
     */
    @Override
    public ResultDto requLoanApplication( String code) {
        RestTemplate restTemplate=new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType mediaType = MediaType.asMediaType(MediaType.APPLICATION_JSON_UTF8);
        headers.setContentType(mediaType);
        HttpEntity<String> httpEntity = new HttpEntity<String>(code, headers);
        ResponseEntity<ResultDto> respVOResponseEntity=restTemplate.postForEntity(CommonRequUrl.loanApplication_url,httpEntity, ResultDto.class);
        ResultDto resultDto=respVOResponseEntity.getBody();
        return resultDto;

    }

}
